#include<cstdio>
#include<cmath>

using namespace std; 

int real(int a) {
	int re=0;
	for(int i=2; i<=sqrt(a); i++) {
		if(a % i == 0) {
			re += i;
			if(i != a/i)
				re += a/i;
		}
	}
	return re+1;
} 

int main() {
	int x,y;
	int a[1000] = {0};
    scanf("%d%d", &x, &y);
    for (int i=x; i<=y; i++) {
    	a[i] = real(i);
	}
    for (int i=x; i<=y; i++) {
    	if(a[i] <= y && i == a[a[i]]) {}
    		printf("%d %d\n", i, a[i]);
	}
    return 0;
}
